# coding:utf-8
# 5.2.1 创建和访问一个元组
tuple1 = (1, 2, 3, 4, 5, 6, 7, 8)
# print (tuple1)
# 访问元组的方式与列表无异
# print (tuple1[1])
# print (tuple1[5:])
# print (tuple1[:5])
tuple2 = tuple1[:]
# print (tuple2)

temp = 1, 2, 3
# print (type(temp))
temp = (1)
# print (type(temp))
type(temp)
# print (type(temp))
temp = ()
# print (type(temp))
# 注意，数组关键 ，


# 5.2.2 更新和删除元组
temp = ("小鸡", "小鸭", "小猪")
temp = temp[:2] + ("小甲鱼",) + temp[2:]
# print(temp)
# 通过拷贝现有的字符串片段构造一个新的字符串的方式解决
temp = temp[:1] + temp[-2:]
print(temp)
